package com.jeeplus.modules.web.service;

import com.jeeplus.core.persistence.DataEntity;
import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;
import com.jeeplus.modules.web.entity.YjMahjongHall;
import com.jeeplus.modules.web.mapper.YjMahjongHallMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 棋牌室Service
 * @author liangbing
 * @version 2021-03-11
 */
@Service
@Transactional(readOnly = true)
public class YjMahjongHallService extends CrudService<YjMahjongHallMapper, YjMahjongHall> {

    @Autowired
    private YjMahjongHallMapper yjMahjongHallMapper;

    public YjMahjongHall get(String id) {
        return super.get(id);
    }

    /**
     * 检查是否重复
     * @param yjMahjongHall
     * @return
     */
    public boolean isDuplicate(YjMahjongHall yjMahjongHall) {
        return yjMahjongHallMapper.isDuplicate(yjMahjongHall) > 0;
    }

    public YjMahjongHall getByRoomQrcode(String roomQrcode) {
        return yjMahjongHallMapper.getByRoomQrcode(roomQrcode, DataEntity.DEL_FLAG_NORMAL);
    }

    public List<YjMahjongHall> findListBySearchText(String openid, String searchText) {
        return yjMahjongHallMapper.findListBySearchText(openid, searchText, DataEntity.DEL_FLAG_NORMAL);
    }

    public List<YjMahjongHall> findListBySearchTextAndDateLevel(String salesmanPhone, String searchText, String dateLevel) {
        return yjMahjongHallMapper.findListBySearchTextAndDateLevel(salesmanPhone, searchText, dateLevel, DataEntity.DEL_FLAG_NORMAL);
    }

    public List<YjMahjongHall> findList(YjMahjongHall yjMahjongHall) {
        return super.findList(yjMahjongHall);
    }

    public Page<YjMahjongHall> findPage(Page<YjMahjongHall> page, YjMahjongHall yjMahjongHall) {
        return super.findPage(page, yjMahjongHall);
    }

    public Long count(YjMahjongHall yjMahjongHall) {
        return super.count(yjMahjongHall);
    }

    @Transactional(readOnly = false)
    public void save(YjMahjongHall yjMahjongHall) {
        super.save(yjMahjongHall);
    }

    @Transactional(readOnly = false)
    public void delete(YjMahjongHall yjMahjongHall) {
        super.delete(yjMahjongHall);
    }

    @Transactional(readOnly = false)
    public void batchDeleteLogic(List<String> ids) {
        super.batchDeleteByLogic(ids);
    }

}
